<template>
  <input type="text" v-model="username" placeholder="Username" />
  <input type="password" v-model="password" placeholder="Password" />
  <button @click="reg">注册</button>
</template>

<script>
import axios from '../plugins/axios'
import qs from 'qs'
import { reactive, toRefs } from 'vue'
export default {
  setup () {
    const state = reactive({
      admin: {
        adminName: '',
        adminLoginName: '',
        adminLoginPwd: ''
      }
    })
    function reg () {
      axios
        .post('http://localhost:9050/xw01/xw-admin/api/admin/reg', state.admin)
        .then(res => {
          console.log(res)
          alert('注册成功 ')
        })
        .catch(err => {
          console.log(err)
        })
    }
    return {
      ...toRefs(state),
      reg
    }
  }
}
</script>
